<?php defined( '_SYS' ) or die( 'No direct script access allowed' );?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title><?php echo $this->title;?></title>
<?php echo $this->headData; ?>
</head>
<body>

	<div id="toolbar-box">
		<div class="t">
			<div class="t">
				<div class="t"></div>
			</div>
		</div>
		<div class="m">
			<div class="toolbar" id="toolbar">
				<table class="toolbar">
					<tr>
						<td class="button" id="toolbar-save">
							<a href="#" onclick="javascript: submitbutton('save')" class="toolbar">
								<span class="icon-32-save" title="Save">
								</span>
							<?php echo C_text::_('Save');?>
							</a>
						</td>

						<td class="button" id="toolbar-apply">
							<a href="#" onclick="javascript: submitbutton('apply')" class="toolbar">
								<span class="icon-32-apply" title="Apply">
								</span>
							<?php echo C_text::_('Apply');?>
							</a>
						</td>

						<td class="button" id="toolbar-cancel">
							<a href="#" onclick="javascript: submitbutton('cancel')" class="toolbar">
								<span class="icon-32-cancel" title="Cancel">
								</span>
							<?php echo C_text::_('Cancel');?>
							</a>
						</td>
					</tr>
				</table>
			</div>
			<div class="header icon-48-user"><?php echo C_text::_('g_ToolBox');?> <small><small><?php echo $this->subTitle;?></small></small></div>	
			<div class="clr"></div>		
		</div>
		<div class="b">
			<div class="b">
				<div class="b"></div>
			</div>
		</div>
	</div>
	<div class="clr"></div>
	<?php if($this->message) echo $this->message;?>
<div id="element-box">
		<div class="t">
			<div class="t">
				<div class="t"></div>
			</div>
		</div>	
<div class="m" id="width-100">	
	
	<form action="<?php echo WEBSELF; ?>/user" method="post" name="adminForm" autocomplete="off">
	<div class="width-100">
	<fieldset>
		<legend><?php echo C_text::_('g_Item1');?></legend>
		<table class="admintable" cellspacing="1">
			<?php
				$db = &C_loader::getDBO();
				$query = 'SELECT id,name,title FROM '.$db->_table_prefix.'access_sections'.
						' WHERE 1!='.$this->item->id.
						' ORDER BY no_order asc'
				;
				$db->setQuery($query);
				$sections = $db->loadObjectList();
				$tmpsections[]=array_shift($sections);
				$tmpsections[0]->title=C_text::_($tmpsections[0]->title);
				$tmpsections[]=array_shift($sections);
				$tmpsections[1]->title=C_text::_($tmpsections[1]->title);
				$tmpsections=C_html::_('select.genericlist', $tmpsections, 'section_id', 'class="inputbox" onChange="showActions();"', 'id', 'title', $this->item->section_id);
				if(!isset($this->item->id) || $this->item->id!=1):				
			?>
				<tr>
					<td width="150" class="key">
						<label for="name">
							<?php echo C_text::_( 'g_Item2' ); ?>
						</label>
					</td>
					<td>
						<?php echo $this->options;?>
					</td>
				</tr>
				<tr>
					<td width="150" class="key">
						<label for="name">
							<?php echo C_text::_( 'g_Item5' ); ?>
						</label>
					</td>
					<td>
						<?php echo $tmpsections;?>
					</td>
				</tr>
			<?php
				endif;
			?>				
				<tr>
					<td width="150" class="key">
						<label for="name">
							<?php echo C_text::_( 'g_Item3' ); ?>
						</label>
					</td>
					<td>
						<input type="text" name="c_form[title]" id="c_form_grouptitle" class="inputbox" size="26" value="<?php if(isset($this->item->title)) echo $this->item->title; ?>" />
					</td>
				</tr>
		</table>
	</fieldset>
</div>
<?php
if($this->item->id==1 || $this->item->section_id==12){
	echo "<div class="width-100" id="showActions" style='display:none;'>";
}else{
	echo "<div class="width-100" id="showActions">";
}
?>
	<fieldset id="user-groups">
		<legend><?php echo C_text::_('g_Item4');?></legend>
		<div class="pane-sliders" id="content-pane">
			<?php
			foreach($sections AS $key=>$val)
			{
			?>
			<div class="panel">
			<h4 id="cpanel-panel-logged" class="title pane-toggler"><a href="#"><span><?php echo C_text::_($val->title);?></span></a></h4>
			<div class="pane-slider content">
				<?php echo C_html::_('access.tb_actions', 'c_form[actions]', $this->item->id,$val->name); ?>
			</div>
		</div>
		<?php
		}
		?>
	</fieldset>
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="option" value="groups" />
	<input type="hidden" name="apply" value="<?php echo $this->apply; ?>" />
	<input type="hidden" name="id" value="<?php if(isset($this->item->id)) echo $this->item->id; ?>" />
	<?php echo C_HTML::_( 'form.token' ); ?>
</div>	
</form>
</div>
		<div class="b">
			<div class="b">
				<div class="b"></div>
			</div>
		</div>
</div>
<center>
	Powered by <b><a href='http://www.metinfo.cn' target='_blank'>MetInfo</a></b> ©2008- <?php echo date('Y',time());?>&nbsp;<a href='http://www.metinfo.cn' target='_blank'>www.MetInfo.cn</a>
</center>
<?php echo $this->js; ?>
</body>
</html>